super._init(params);
this._grid = new IconGrid.IconGrid();
- this._grid.connect('child-focused', (grid, actor) => {
- this._childFocused(actor);
- });
// Standard hack for ClutterBinLayout
this._grid.x_expand = true;
});
}
- _childFocused(_actor) {
- // Nothing by default
- }
-
_redisplay() {
let oldApps = this._orderedItems.slice();
let oldAppIds = oldApps.map(icon => icon.id);
});
}
- _childFocused(icon) {
- let itemPage = this._grid.getItemPage(icon);
- this.goToPage(itemPage);
- }
// Called before allocation to calculate dynamic spacing
adaptToSize(width, height) {
super.vfunc_allocate(box);
}
- _childFocused(actor) {
- Util.ensureActorVisibleInScrollView(this._scrollView, actor);
- }
-
// Overridden from BaseAppView
animate(animationDirection) {
this._grid.animatePulse(animationDirection);
Signals: {
'pages-changed': {},
'animation-done': {},
- 'child-focused': { param_types: [Clutter.Actor.$gtype] },
},
}, class IconGrid extends St.Viewport {
_init(layoutParams = {}) {
}
_childAdded(grid, child) {
- child._iconGridKeyFocusInId = child.connect('key-focus-in', actor => this.emit('child-focused', actor));
+ child._iconGridKeyFocusInId = child.connect('key-focus-in', () => {
+ this._ensureItemIsVisible(child);
+ });
child._paintVisible = child.opacity > 0;
child._opacityChangedId = child.connect('notify::opacity', () => {
});
}
+ _ensureItemIsVisible(item) {
+ if (!this.contains(item))
+ throw new Error(`${item} is not a child of IconGrid`);
+
+ const itemPage = this.layout_manager.getItemPage(item);
+ this.goToPage(itemPage);
+ }
+
_setGridMode(modeIndex) {
if (this._currentMode === modeIndex)
return;